package com.nauu.atombuilder.figures;

import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

public class FormFigure extends NodeFigure{
	
    private Label label;
    
    private Ellipse rectangleFigure;

    public FormFigure() {
    	this.rectangleFigure = new Ellipse();
        this.label = new Label();
        this.add(rectangleFigure);
        this.add(label);
    }

    public String getText() {
        return this.label.getText();
    }

    public Rectangle getTextBounds() {
        return this.label.getTextBounds();
    }

    public void setName(String name) {
        this.label.setText(name);
        this.rectangleFigure.repaint();
    }

    //------------------------------------------------------------------------
    // Overridden methods from Figure

    public void setBounds(Rectangle rect) {
        super.setBounds(rect);
        this.rectangleFigure.setBounds(rect);
        this.label.setBounds(rect);
    }

	@Override
	public void translateToAbsolute(Dimension font) {
		this.rectangleFigure.translateToAbsolute(font);
	}

	@Override
	public void setBackgroundColor(Color color) {
		this.rectangleFigure.setBackgroundColor(color);
	}
	
}
